package com.hd.trans.config

import android.graphics.Color
import com.hd.trans.R
import com.hd.trans.utils.JudgeUtil

class ThemeProperty private constructor(){
    var themeColor: Int = Color.parseColor("#FF016DEF")
    var logoResId: Int = R.mipmap.ic_launcher

    class Builder {
        private val property = ThemeProperty()

        fun build(): ThemeProperty {
            return property
        }

        /**
         * 主体色，如：Color.WHITE
         */
        fun setThemeColor(themeColor: Int): Builder {
            property.themeColor = themeColor
            return this
        }

        /**
         * 主体色，如：#FF016DEF
         */
        fun setThemeColor(themeColorStr: String): Builder {
            if(JudgeUtil.isValidColor(themeColorStr)){
                property.themeColor =  Color.parseColor(themeColorStr)
            }
            return this
        }

        /**
         * 应用图标logo，如：R.drawable.trans_logo
         */
        fun setLogoResId(logoId: Int): Builder {
            property.logoResId = logoId
            return this
        }
    }
}